var    menuData = 
	{
		count: 8,
		m_1000:
		{
				moduleHtml : 
					'<ul class="nav" id="nav-sidebar" >'
					+'<li><a  href="" url=""><i class="icon-home"></i><span>Dashboard</span></a></li>'
//					+'<button class="btn btn-mini" type="submit" onclick="editTree()">edit tree</button>'
					+'</ul>'
					+'<div id="customTree" class="ztree" ></div>'
		},
		m_2000:
		{
			moduleHtml:"<ul class='nav' id='nav-sidebar'>"
						+'<li>'
						+'<a href="javascript:;" url=""><i class="icon-edit"></i><span>展现树配置</span></a>'
						+'<ul>'
						+'<li><a href="javascript:;" url="rest/tree/editTree"><i class="icon-caret-right"></i><span>节点管理</span></a></li>'
						+'<li><a href="javascript:;" url="rest/dash/getParam"><i class="icon-caret-right"></i><span>参数管理</span></a></li>'
						+'<li><a href="javascript:;" url="rest/dash/getPtns"><i class="icon-caret-right"></i><span>点位数据源管理</span></a></li>'
						+'<li><a href="javascript:;" url="rest/dash/getViewLst"><i class="icon-caret-right"></i><span>展现视图管理</span></a></li>'
						+'</ul>'
						+'</li>'
						+'</ul>'
		},
		m_3000:
		{
			
			moduleHtml:""
			
		},
		m_4000:
		{
			moduleHtml:""

		},
		m_5000:
		{
			moduleHtml:""

		},
		m_6000:
		{
			moduleHtml:"<ul class='nav' id='nav-sidebar'>"
				+'<li><a href="javascript:;" url=""><i class="icon-home"></i><span>运维管理</span></a></li>'
				+'<li>'
				+'<a><i class="icon-edit"></i><span>产品管理</span></a>'
				+'<ul>'
				+'<li id="supplierList"><a href="cmdb/supplier/initSupplierList"><i class="icon-caret-right"></i><span>供应商管理</span></a></li>'
				+'<li id="productList"><a href="cmdb/product/initProductList"><i class="icon-caret-right"></i><span>产品信息管理</span></a></li>'
				+'</ul>'
				+'</li>'
				+'<li>'
				+'<a><i class="icon-th-large"></i><span>设备管理</span></a>'
				+'<ul>'
				+'<li id="deviceEntityList"><a href="cmdb/device/initDeviceEntityList"><i class="icon-caret-right"></i><span>设备实体信息管理</span></a></li>'
				+'<li><a><i class="icon-caret-right"></i><span>设备维修管理</span></a></li>'
				+'</ul>'
				+'</li>'
				+'</ul>'
		},
		m_7000:
		{
			moduleHtml:"<ul class='nav' id='nav-sidebar'>"
						+'<li>'
						+'<a href="javascript:;" url="cmdb/product/initProductList"><i class="icon-edit"></i><span>产品管理</span></a>'
						+'<ul>'
						+'<li><a href="javascript:;" url="cmdb/supplier/initSupplierList"><i class="icon-caret-right"></i><span>供应商管理</span></a></li>'
						+'<li><a href="javascript:;" url="cmdb/product/initProductList"><i class="icon-caret-right"></i><span>产品信息管理</span></a></li>'
						+'</ul>'
						+'</li>'
						+'<li>'
						+'<a href="javascript:;" url=""><i class="icon-th-large"></i><span>设备管理</span></a>'
						+'<ul>'
						+'<li id="deviceEntityList"><a href="javascript:;" url="cmdb/device/initDeviceEntityList"><i class="icon-caret-right"></i><span>设备实体信息管理</span></a></li>'
						+'<li><a><i class="icon-caret-right"></i><span>设备维修管理</span></a></li>'
						+'</ul>'
						+'</li>'
						+'<li>'
						+'<a href="javascript:;" url=""><i class="icon-bar-chart"></i><span>基础数据管理</span></a>'
						+'<ul>'
						+'<li><a><i class="icon-caret-right"></i><span>区域信息管理</span></a></li>'
						+'<li><a><i class="icon-caret-right"></i><span>负责人信息管理</span></a></li>'
						+'<li><a href="javascript:;" url="cmdb/sysDict/initSysDictList"><i class="icon-caret-right"></i><span>代码字典管理</span></a></li>'
						+'<li><a><i class="icon-caret-right"></i><span>系统参数管理</span></a></li>'
						+'<li><a><i class="icon-caret-right"></i><span>数据备份与恢复</span></a></li>'
						+'</ul>'
						+'</li>'
						+'</ul>'
		},
		m_8000:
		{
			moduleHtml:""
		},
		m_10000:
		{
			moduleHtml:""
		}
	};

    


function menu_navigate(naviType, childFlag, suffix)
{
	$("#nav-main").children().remove();
	$("#nav-main").append(eval("menuData.m_"+naviType+".moduleHtml"));
	resetNavigationSidebar(childFlag);
	if (1000==naviType){
		initViewTree("customTree", suffix);
	}
}

function resetNavigationSidebar(childFlag) {
	/* Begin: Sidebar Navigation */
		$('#nav-sidebar li').each(function(){
		if ($(this).children('ul').html())
		{
			var icon = 'down';
			if ($(this).attr('class') == 'active')
			{
				icon = 'up';
			}
			var $append = '<em class="icon-angle-' + icon + '"></em>';
			$(this).find('a:first-child').append($append);
		}
		$(this).find('li').find('em').remove();
	});
	
	$('#nav-sidebar li').click(function(){
	
		$redirect = false;
	
		/* Begin: Sidebar Auto Fixing */
		$('#content .sidebar').resize(function(){
			if ($(window).height() - 100 <= $('#content .sidebar ul.nav').height())
			{
				$('#content .sidebar').css({ position: 'relative' });
			}
			else
			{
				$('#content .sidebar').css({ position: 'fixed', height: '100%' });
			}
		});
		$(window).resize(function(){
			if ($(window).height() - 100 <= $('#content .sidebar ul.nav').height())
			{
				$('#content .sidebar').css({ position: 'relative' });
			}
			else
			{
				$('#content .sidebar').css({ position: 'fixed', height: '100%' });
			}
		});
		/* End: Sidebar Auto Fixing */
	
		if ($(this).find('span').is(':visible'))
		{
			var $subnav = $(this).children('ul');
			if ($subnav.html())
			{
				var $parent = $subnav.parent('li');
				var $arrow = $(this).find('em');
				if ($subnav.is(':visible'))
				{
					$subnav.slideUp(200, 'swing');
					$parent.removeClass('open');
					$arrow.addClass('icon-angle-down');
					$arrow.removeClass('icon-angle-up');
				}
				else
				{
					$subnav.slideDown(400, 'easeOutBounce');
					$parent.addClass('open');
					$arrow.addClass('icon-angle-up');
					$arrow.removeClass('icon-angle-down');
				}
			}
			else
			{
				$redirect = true;
			}
		}
		else
		{
			$redirect = true;
		}
		if ($redirect)
		{
			if($(this).find('a').attr('url')!="")
			{
				window.parent.document.getElementById("mainFrame").src = $(this).find('a').attr('url');
				$('#nav-sidebar li').removeClass('active');
				$(this).addClass('active');
				//取消选中模块的样式
				$('#nav-sidebar li ul li a').css('background-color',"transparent");
				//为选中模块添加背景
				$(this).find('a').css('background-color',"#C4E1E1");
				$(this).parent('ul').parent('li').addClass('active');
			}			
		}
	
		return false;
	});
	/* End: Sidebar Navigation */
	
}


/*
function resetNavigationSidebar(childFlag) {
		$('#nav-sidebar li').each(function(){
		if ($(this).children('ul').html())
		{
			var icon = 'down';
			if ($(this).attr('class') == 'active')
			{
				icon = 'up';
			}
			var $append = '<em class="icon-angle-' + icon + '"></em>';
			$(this).find('a:first-child').append($append);
		}
		$(this).find('li').find('em').remove();
	});
	
	$('#nav-sidebar li').click(function(){
	
		$redirect = false;
	
		$('#content .sidebar').resize(function(){
			if ($(window).height() - 100 <= $('#content .sidebar ul.nav').height())
			{
				$('#content .sidebar').css({ position: 'relative' });
			}
			else
			{
				$('#content .sidebar').css({ position: 'fixed', height: '100%' });
			}
		});
		$(window).resize(function(){
			if ($(window).height() - 100 <= $('#content .sidebar ul.nav').height())
			{
				$('#content .sidebar').css({ position: 'relative' });
			}
			else
			{
				$('#content .sidebar').css({ position: 'fixed', height: '100%' });
			}
		});
	
		if ($(this).find('span').is(':visible'))
		{
			var $subnav = $(this).children('ul');
			if ($subnav.html())
			{
				var $parent = $subnav.parent('li');
				var $arrow = $(this).find('em');
				if ($subnav.is(':visible'))
				{
					$subnav.slideUp(200, 'swing');
					$parent.removeClass('open');
					$arrow.addClass('icon-angle-down');
					$arrow.removeClass('icon-angle-up');
				}
				else
				{
					$subnav.slideDown(400, 'easeOutBounce');
					$parent.addClass('open');
					$arrow.addClass('icon-angle-up');
					$arrow.removeClass('icon-angle-down');
				}
			}
			else
			{
				$redirect = true;
			}
		}
		else
		{
			$redirect = true;
		}
		if ($redirect)
		{
			if($(this).find('a').attr('url')!="")
			{
				// cacel ViewListGroup Interval
				if (typeof cacelViewLstGrpInterval != 'undefined')
					cacelViewLstGrpInterval();
				
				window.parent.document.getElementById("mainFrame").src = $(this).find('a').attr('url');
				$('#nav-sidebar li').removeClass('active');
				$(this).addClass('active');
				$(this).parent('ul').parent('li').addClass('active');
			}			
		}
		
		return false;
	});
}
*/

var editTreeDialog;
function editTree(){
	editTreeDialog = $.dialog({
		lock: true, 
	    id: "edit_tree",
	    title: "编辑树节点",
	    content: "url:rest/tree/editTree"+suffix,
	    padding: 0,
	    width: 650,
	    height: 420,
	    max:false,
	    min:false,
	    esc:false 
	});
}

